This counter script is built for users to be able to create a counter
program in-lined into their home page without having to use Server Side
Includes.
To use this counter program, you will need to go get a program called
FLY, which allows an easy interface into the GD graphics library, which
is written in C. I easily compiled fly without any problems on several
different machines: SunOS, OSF 3.2, and more. You can get FLY at:
http://www.unimelb.edu.au/fly/fly.html
But it is necessary to have this or else my counter program will not work. Version 1.1 of my counter program was written to correspond with version 1.1 of FLY and you will need to upgrade if you are still using version 1.0 of FLY.
My counter program comes with 7 files:
1) counter.pl - The Counter Program Itself.
2) count.txt - The data file that holds the counter number.
3) access_log - Log file of accesses to your counter.
4) error_log - Log file of errors your counter has produced.
5) html_log.pl - Produce nice HTML file of access_log.
The count file is the file in which the number of accesses will
be displayed. It is not a good idea to edit this file by hand as it can
cause pesky new line characters, or may mess up the number. Use
new_count.pl to start with a different number, or simply start with the
default value which is 0.
$digit_dir = "/home/user/counter/digits/XXXX";
This is the directory that the digits for your counter are in.
In this directory, you must have files numbered 0.gif - 9.gif. They must
all be of equal width and height for this counter to work. I may make it
more flexible in the next version.
$access_log = "/home/user/counter/access_log";
This counter also comes with the option of having logs with it,
including a perl script which will nicely format results into a cool html
page. You don't have to worry about the path to this file if you turn
the $uselog variable off, but if you set $uselog to 1, then make sure
you have the correct path to a file called access_log and that this file
and the directory it is in is readable and writable by the web server
uid. This means chmod them 777.
$error_log = "/home/user/counter/error_log";
This is the same as the access_log above, except for the fact
that this file will contain any errors that users may get when trying to
access your counter. This is currently limited to a Time Out and a Bad
Referer. Please note that these should be the paths to your local
access_log and error_log files that come with this script. Do not link
them to your main error and access_log files.
$flyprog = "/home/user/counter/fly/fly";
The fly program is required for this counter program to work. It
is easy to install and once you do, make sure you chmod the 'fly'
program file 755 o anyone can execute it and then change the above
example path to the path of your real fly program.
$fly_temp = "/home/user/counter/fly_temp.gif";
For this script to work it will need to have a temporary file to which it can print commands for fly to execute. This file will be generated by the script the first time it is run and each time it is run it will be deleted. Should someone stop the load
ing process in the middle of execution and this file not get deleted it will just be overwritten the next time the script is called.
This file can be used to generate a nice HTML 3 Table formatted document
of your access_log. It still looks nice in other browsers that do not
support 3.0 though. There is a little configuring you will have to do
with this file. The major change in this file from version 1.0 is that you can choose whether you woudl like to be able to access this file through the web or run it at the prompt. If you have huge stat files you will probably wan tot run it at a unix p
rompt and redirect the output to a file, so that you don't have to regenerate stats every time you want to view them. ON the other hand, if you don't have telnet access or dial up access to a unix prompt you will want to set the $web option to 1 so that
you can just call this script through the web and it will generate the stats on the fly.
This option allows you to configure the script to either run from the web or to be used as a program that you runb at the prompt and redirect output. If you choose to set this to '1', then you can simply call the program as a web page, however if you ch
oose to set this to 0, you should run this at the prompt like:
html_log.pl > stats.html
$log_file = "/home/user/counter/access_log";
This should be defined exactly the same as you defined
$access_log in your counter.pl file. Simply the system path to the
access_log file that my counter program creates.
$min_remote = "10";
This is the minimum number of accesses a remote host must have
for them to make your html list.
$min_agent = "5";
This is the minimum number of times a browser must access your
page before it shows up in your list of browsers accessing your page.
This image file needs to be placed in the spot indicated by the
$bad_referer.gif variables in the counter.pl file. It needs to be chmoded 744 so that it is readable by everyone and so that the web server can link to them in case of a time out.
Let me know if you have any problems with the counter images!
CALLING THE SCRIPT
==================
I accidentally left out the part about how to call this program in my previous release. You simply can call this program like you would call any other image or background picture. Examples are shown below: